<?PHP



function AddCancelScript () {
        echo "<script language='JavaScript' type='text/javascript'>\n";
        echo "function cancel() {\n";
        echo "window.returnValue = null;\n";
        echo "window.close();\n";
        echo "}\n";
        echo "</script>";
}

function AddTableScript () {
        echo "<script language='JavaScript' type='text/javascript'>\n";
        echo "function tab(w,h) {\n";
        echo "        var strtab = [\"<TABLE border='1' cellspacing='0' cellpadding='0' align='center' bordercolor='#dcdcdc' bgcolor='#C0C0C0'>\"]\n";
        echo "        var k = 0;\n";
        echo "        for(var i = 0; i < w; i++) {\n";
        echo "                strtab[strtab.length] = \"<TR>\";\n";
        echo "                for(var j = 0; j < h; j++) {\n";
        echo "                        strtab[strtab.length] = \"<TD width='14' align='center' onClick='getchar(this)' onMouseOver='hover(this,true)' onMouseOut='hover(this,false)'>\"+(chars[k]||'')+\"</TD>\";\n";
        echo "                        k++;\n";
        echo "                }\n";
        echo "                strtab[strtab.length]=\"</TR>\";\n";
        echo "        }\n";
        echo "        strtab[strtab.length] = \"</TABLE>\";\n";
        echo "        return strtab.join(\"\\n\");\n";
        echo "}\n";
        echo "</script>";
}

function AddHoverScript () {
        echo "<script language='JavaScript' type='text/javascript'>\n";
        echo "function hover(obj,val) {\n";
        echo "        if (!obj.innerHTML) {\n";
        echo "                obj.style.cursor = \"default\";\n";
        echo "                return;\n";
        echo "        }\n";
        echo "        obj.style.border = val ? \"1px solid black\" : \"1px solid #dcdcdc\";\n";
        echo "}\n";
        echo "</script>";
}

function AddGetCharScript () {
        echo "<script language='JavaScript' type='text/javascript'>\n";
        echo "function getchar(obj) {\n";
        echo "        if(!obj.innerHTML) return;\n";
        echo "        window.returnValue = obj.innerHTML || \"\";\n";
        echo "        window.close();\n";
        echo "}\n";
        echo "</script>";
}

function AddAttrScript () {
        echo "<script language='JavaScript' type='text/javascript'>\n";
        echo "function attr(name, value) {\n";
        echo "if (!value || value == \"\") return \"\";\n";
        echo "return ' ' + name + '=\"' + value + '\"';\n";
        echo "}\n";
        echo "</script>";
}

function AddInsertSmilieScript () {
        echo "<script language='JavaScript' type='text/javascript'>\n";
        echo "function insertSmilie() {\n";
        echo "        var img = window.event.srcElement;\n";
        echo "        if (img) {\n";
        echo "                var src = img.src.replace(/^[a-z]*:[/][/][^/]*/, \"\");\n";
        echo "                window.returnValue = '<IMG border=0 align=absmiddle src=' + src + '>'\n;";
        echo "                window.close();\n";
        echo "        }\n";
        echo "}\n";
        echo "</script>";
}

function AddJoueursScript () {
        echo "<script language='JavaScript' type='text/javascript'>\n
        var texte='';";
        echo "function insertJoueurs() {\n";
        echo "        var img = window.event.srcElement;\n";
        echo "        if (img) {\n";
        echo "                var src = img.src.replace(/^[a-z]*:[/][/][^/]*/, \"\");\n";
        echo "                texte += '<IMG border=0 align=absmiddle src='+src+'>';\n";
        echo "                window.returnValue = texte;\n";
        #echo "                window.close();\n";
        echo "        }\n";
        echo "}\n";
        echo "</script>";
}
?>
